package com.service.imple.home;

import com.dao.VipUserMapper;
import com.entity.VipUser;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.service.home.VipUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class VipUserServiceImple implements VipUserService {

    @Autowired
    private VipUserMapper vipUserMapper;

    @Override
    public PageInfo<VipUser> selectByPage(Map<String, Object> param) {
        int pageNum=Integer.parseInt(param.get("pageNum").toString());
        PageHelper.startPage(pageNum,6);
        List<VipUser> list = vipUserMapper.selectPage(param);
        PageInfo<VipUser> info =new PageInfo<>(list);
        return info;
    }

    @Override
    public List<VipUser> select(Map map) {
        return vipUserMapper.selectPage(map);
    }

    @Override
    public List<VipUser> selectAll(VipUser vipUser) {
        return vipUserMapper.selectAll(vipUser);
    }

    @Override
    public int updateByPrimaryKeyWithBLOBs(VipUser vipUser) {
        return vipUserMapper.updateByPrimaryKeyWithBLOBs(vipUser);
    }

    @Override
    public int insert(VipUser vipUser) {
        return vipUserMapper.insert(vipUser);
    }

    @Override
    public int update(VipUser vipUser) {
        return vipUserMapper.updateByPrimaryKey(vipUser);
    }

    @Override
    public int delete(int id) {
        return vipUserMapper.deleteByPrimaryKey(id);
    }
}
